package com.eastfair.projectcore.dto;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableField;
import com.eastfair.projectcore.enumeration.MenuMenuTypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.List;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 菜单
 * </p>
 *
 * @author ligang
 * @since 2021-07-22
 */
@Data
@ApiModel(value = "MenuDTO", description = "菜单")
public class MenuDTO implements Serializable {

    public interface  createMenu{}

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "菜单id")
    private Long id;

    /**
     * 菜单名称
     */
    @ApiModelProperty(value = "菜单名称")
    @Size(max = 255, message = "菜单名称长度不能超过255")
    @TableField(value = "name", condition = LIKE)
    @Excel(name = "菜单名称")
    @NotBlank(groups = {createMenu.class},message = "请填写菜单名称")
    private String name;

    /**
     * 菜单名称（英文）
     */
    @ApiModelProperty(value = "菜单名称（英文）")
    @Size(max = 255, message = "菜单名称（英文）长度不能超过255")
    @TableField(value = "en_name", condition = LIKE)
    @Excel(name = "菜单名称（英文）")
    private String enName;

    /**
     * code码
     */
    @ApiModelProperty(value = "code码")
    @NotEmpty(message = "请填写code码")
    @Size(max = 255, message = "code码长度不能超过255")
    @TableField(value = "code", condition = LIKE)
    @Excel(name = "code码")
    private String code;

    /**
     * 菜单类型 #{catalog:目录;menu:菜单;button:按钮}
     */
    @ApiModelProperty(value = "菜单类型 #{catalog:目录;menu:菜单;button:按钮}")
    @TableField(value = "menu_type")
    @Excel(name = "菜单类型 #{catalog:目录;menu:菜单;button:按钮}", replace = {"目录_CATALOG", "菜单_MENU", "按钮_BUTTON",  "_null"})
    @NotNull(groups = {createMenu.class},message = "请填写菜单类型")
    private MenuMenuTypeEnum menuType;

    /**
     * 值例如：www.baidu  / 内联地址等等
     */
    @ApiModelProperty(value = "值例如：www.baidu  / 内联地址等等")
    @Size(max = 255, message = "值例如：www.baidu  / 内联地址等等长度不能超过255")
    @TableField(value = "link", condition = LIKE)
    @Excel(name = "值例如：www.baidu  / 内联地址等等")
//    @NotBlank(groups = {createMenu.class},message = "请填写link值")
    private String link;

    /**
     * 路由参数
     */
    @ApiModelProperty(value = "路由参数")
    @Size(max = 255, message = "路由参数长度不能超过255")
    @TableField(value = "link_param", condition = LIKE)
    @Excel(name = "路由参数")
    private String linkParam;

    /**
     * icon
     */
    @ApiModelProperty(value = "icon")
    @Size(max = 255, message = "icon长度不能超过255")
    @TableField(value = "icon", condition = LIKE)
    @Excel(name = "icon")
    private String icon;

    /**
     * 排序
     */
    @ApiModelProperty(value = "排序")
    @TableField(value = "sequence")
    @Excel(name = "排序")
    private Integer sequence;

    /**
     * 父级id
     */
    @ApiModelProperty(value = "父级id")
    @TableField(value = "parent_id")
    @Excel(name = "父级id")
    @NotNull(groups = {createMenu.class},message = "请填写父级id")
    private Long parentId;

    /**
     * 是否生效(默认1：可用 0:不可用)
     */
    @ApiModelProperty(value = "是否生效(默认1：可用 0:不可用)")
    @TableField(value = "is_enabled")
    @Excel(name = "是否生效(默认1：可用 0:不可用)")
    @NotNull(groups = {createMenu.class},message = "请填写是否生效")
    private Integer isEnabled;



    /**
     * 是否外链(默认1：是 0:否)
     */
    @ApiModelProperty(value = "是否外链(默认1：是 0:否)")
    @TableField(value = "is_out_link")
    @Excel(name = "是否外链(默认1：是 0:否)")
    @NotNull(groups = {createMenu.class},message = "请填写是否外链")
    private Integer isOutLink;

    /**
     * 是否显示(默认1：是 0:否)
     */
    @ApiModelProperty(value = "是否显示(默认1：是 0:否)")
    @TableField(value = "is_show")
    @Excel(name = "是否显示(默认1：是 0:否)")
    @NotNull(groups = {createMenu.class},message = "请填写是否显示")
    private Integer isShow;


    @ApiModelProperty(value = "菜单id集合")
    @NotNull(message = "菜单id集合")
    private List<Long> menuIds;

    /**
     * 权限字符
     */
    @ApiModelProperty(value = "权限字符")
    @Size(max = 255, message = "权限字符长度不能超过255")
    private String permission;

    /**
     * 菜单类型集合 #{catalog:目录;menu:菜单;button:按钮}
     */
    @ApiModelProperty(value = "菜单类型 #{catalog:目录;menu:菜单;button:按钮}")
    private List<MenuMenuTypeEnum> menuMenuTypeEnumList;

    /**
     * 组件路径,前端资源路径，给前端用的
     */
    @ApiModelProperty(value = "组件路径,前端资源路径，给前端用的")
    @Size(max = 255, message = "组件路径,前端资源路径，给前端用的长度不能超过255")
    @TableField(value = "module_url", condition = LIKE)
    @Excel(name = "组件路径,前端资源路径，给前端用的")
    private String moduleUrl;




}
